package com.ruoyi.swla2.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.swla2.domain.ReadingHistoryDataYc;
import com.ruoyi.swla2.service.IReadingHistoryDataYcService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 小-抄数据(远传)Controller
 * 
 * @author gdqt
 * @date 2025-04-19
 */
@RestController
@RequestMapping("/swla2/yc")
public class ReadingHistoryDataYcController extends BaseController
{
    @Autowired
    private IReadingHistoryDataYcService readingHistoryDataYcService;

    /**
     * 查询小-抄数据(远传)列表
     */
    @PreAuthorize("@ss.hasPermi('swla2:yc:list')")
    @GetMapping("/list")
    public TableDataInfo list(ReadingHistoryDataYc readingHistoryDataYc)
    {
        startPage();
        List<ReadingHistoryDataYc> list = readingHistoryDataYcService.selectReadingHistoryDataYcList(readingHistoryDataYc);
        return getDataTable(list);
    }

    /**
     * 导出小-抄数据(远传)列表
     */
    @PreAuthorize("@ss.hasPermi('swla2:yc:export')")
    @Log(title = "小-抄数据(远传)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ReadingHistoryDataYc readingHistoryDataYc)
    {
        List<ReadingHistoryDataYc> list = readingHistoryDataYcService.selectReadingHistoryDataYcList(readingHistoryDataYc);
        ExcelUtil<ReadingHistoryDataYc> util = new ExcelUtil<ReadingHistoryDataYc>(ReadingHistoryDataYc.class);
        util.exportExcel(response, list, "小-抄数据(远传)数据");
    }

    /**
     * 获取小-抄数据(远传)详细信息
     */
    @PreAuthorize("@ss.hasPermi('swla2:yc:query')")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") Long ID)
    {
        return success(readingHistoryDataYcService.selectReadingHistoryDataYcByID(ID));
    }

    /**
     * 新增小-抄数据(远传)
     */
    @PreAuthorize("@ss.hasPermi('swla2:yc:add')")
    @Log(title = "小-抄数据(远传)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ReadingHistoryDataYc readingHistoryDataYc)
    {
        return toAjax(readingHistoryDataYcService.insertReadingHistoryDataYc(readingHistoryDataYc));
    }

    /**
     * 修改小-抄数据(远传)
     */
    @PreAuthorize("@ss.hasPermi('swla2:yc:edit')")
    @Log(title = "小-抄数据(远传)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ReadingHistoryDataYc readingHistoryDataYc)
    {
        return toAjax(readingHistoryDataYcService.updateReadingHistoryDataYc(readingHistoryDataYc));
    }

    /**
     * 删除小-抄数据(远传)
     */
    @PreAuthorize("@ss.hasPermi('swla2:yc:remove')")
    @Log(title = "小-抄数据(远传)", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable Long[] IDs)
    {
        return toAjax(readingHistoryDataYcService.deleteReadingHistoryDataYcByIDs(IDs));
    }
}
